home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / getrlimit.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  3.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. GETRLIMIT(3)        MINTLIB LIBRARY FUNCTIONS        GETRLIMIT(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        getrlimit,  setrlimit  -  control  maximum system resource
  9.        con- sumption
  10.  
  11. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  12.        #include <sys/time.h>
  13.        #include <sys/resource.h>
  14.  
  15.        int getrlimit(int kind, struct rlimit *rlp);
  16.  
  17.        int setrlimit(int kind, struct rlimit *rlp);
  18.  
  19. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  20.        Limits on the consumption of system resources by the  cur-
  21.        rent  process  and each process it creates may be obtained
  22.        with the getrlimit call, and set with the setrlimit  call.
  23.        These functions only work for real if MiNT is active.
  24.  
  25.        The following resource parameters are allowed:
  26.  
  27.          RLIMIT_CPU    the maximum amount of cpu time (in
  28.                        milliseconds)  to be used by each process.
  29.  
  30.          RLIMIT_FSIZE  the largest size, in bytes, of any single
  31.                        file that may be created.
  32.  
  33.          RLIMIT_DATA   the maximum size, in bytes, of the data
  34.                        the process may allocate with Malloc.
  35.  
  36.          RLIMIT_STACK  the maximum size, in bytes, of the stack
  37.                        segment for a process.
  38.  
  39.          RLIMIT_CORE   the largest size, in bytes, of a core file
  40.                        that may be created.
  41.  
  42.          RLIMIT_RSS    the maximum size, in bytes, allowed for
  43.                        the process.
  44.  
  45.        Of  these, only the RLIMIT_CPU, RLIMIT_DATA and RLIMIT_RSS
  46.        parameters are supported. The others do nothing. The  UN*X
  47.        parameter  RLIMIT_NOFILE  is  not  available in the header
  48.        file at all. Also, the value of the  RLIMIT_CPU  parameter
  49.        is in milliseconds, while the UN*X version is specified in
  50.        seconds.
  51.  
  52.        A resource limit is specified as a soft limit and  a  hard
  53.        limit.  When a soft limit is exceeded a process receives a
  54.        signal SIGXCPU if the cpu time is exceeded; memory alloca-
  55.        tions  will fail if RLIMIT_DATA or RLIMIT_RSS is exceeded.
  56.        Hard limits are not enforced at all.
  57.  
  58.        The struct rlimit is defined as follows:
  59.          struct rlimit
  60.          {
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GETRLIMIT(3)        MINTLIB LIBRARY FUNCTIONS        GETRLIMIT(3)
  71.  
  72.  
  73.            long rlim_cur; /* current (soft) limit       */
  74.            long rlim_max; /* hard limit (not supported) */
  75.          };
  76.  
  77.        Contradicting the UN*X version, any process  may  increase
  78.        its limits at will.
  79.  
  80.        An   "infinite"   value   for   a   limit  is  defined  as
  81.        RLIM_INFINITY (0x7fffffff).
  82.  
  83. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  84.        getrlimit and setrlimit return:
  85.  
  86.         0  on success.  -1  on failure; errno is set to EINVAL.
  87.  
  88. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  89.        P✓Ps✓se✓et✓tl✓li✓im✓mi✓it✓t(✓(2✓2)✓),✓, g✓ge✓et✓tr✓ru✓us✓sa✓ag✓ge✓e(✓(3✓3)✓),✓, s✓si✓ig✓gn✓na✓al✓l(✓(3✓3)✓)
  90.  
  91. B✓BU✓UG✓GS✓S
  92.        These functions are so different from their  UN*X  equiva-
  93.        lents that they are practically worthless.
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. MiNT docs 0.1              3 March 1993                         2
  131.  
  132.  
  133.